<script type="text/javascript">
    function add() {
        window.location.href = "?mod=<?= $mod ?>&act=edit";
    }

    function edit(id) {
        window.location.href = "?mod=<?= $mod ?>&act=edit&id=" + id;
    }

    function del(id) {
        var frm = document.frmlist;
        bok = confirm("<?= $msg_deleteone ?>");
        if (bok) {
            frm.listid.value = id + ",";
            frm.action = "?mod=<?= $mod ?>&act=process";
            frm.submit();
        }
    }

    function delall(id) {
        var frm = document.frmlist;
        if (<?= $totalrows ?> != 0)
            frm.listid.value = selectid(frm.chkid);
        if (frm.listid.value == "") {
            if (<?= $totalrows ?> != 0)
                alert("<?= $msg_ask_select ?>");
        }
        else {
            bok = confirm("<?= $msg_conf_del ?>");
            if (bok) {
                frm.action = "?mod=<?= $mod ?>&act=process";
                frm.submit();
            }
        }
    }


    function save() {
        location.reload(true);
    }

    function savelist() {
        var frm = document.frmlist;
        frm.form_.value = "savelist";
        frm.action = "?mod=<?= $mod ?>&act=process";
        frm.submit();
    }
</script>

<script type="text/javascript" src="scriptaculous/prototype.js"></script>  
<script type="text/javascript" src="scriptaculous/scriptaculous.js"></script>  
<script type="text/javascript">
//<![CDATA[  
    document.observe('dom:loaded', function() {
        var changeEffect;
        Sortable.create('sortlist', {tag: 'li', overlap: 'horizontal', constraint: false,
            onChange: function(item) {
                var list = Sortable.options(item).element;
                //$('changeNotification').update(Sortable.serialize(list).escapeHTML());  
                if (changeEffect)
                    changeEffect.cancel();
                changeEffect = new Effect.Highlight('changeNotification', {restoreColor: "transparent"});
            },
            onUpdate: function() {
                new Ajax.Request("<?= $mod ?>_order.php", {
                    method: "post",
                    onLoading: function() {
                        $('activityIndicator').show()
                    },
                    onLoaded: function() {
                        $('activityIndicator').hide()
                    },
                    parameters: {data: Sortable.serialize("sortlist")}
                });
            }
        });
    });
// ]]>  
</script>  
